package com.taijihuabao.modules.service.impl;

import com.alibaba.excel.util.CollectionUtils;
import com.taijihuabao.common.exception.ServiceException;
import com.taijihuabao.common.jsonresult.ApplicationResponseCode;
import com.taijihuabao.modules.mapper.ApprovalHistoryMapper;

import javax.annotation.Resource;
import java.util.List;

public class ApprovalHistoryServiceImpl {

    @Resource
    private ApprovalHistoryMapper approvalHistoryMapper;

    /**
     * 根据审批人id查询历史审批任务
     * @param userId
     * @return
     */
    public List selectByApprovalUserId(Long userId) {
        List list = approvalHistoryMapper.selectByApprovalUserId(userId);
        if (CollectionUtils.isEmpty(list)) {
            throw new ServiceException(ApplicationResponseCode.APPROVAL_NOT_FOUND);
        }
        return list;
    }
}
